// 封装网络请求

export default (obj) => {
	uni.showLoading({
		title: '加载中...',
	})

	return new Promise((resolve, reject) => {
		wx.cloud.callFunction({
			name: obj.name,
			data: obj.data || {},
			success: (res) => {
				resolve(res.result)
			},
			fail: (res) => {
				reject(res)
			},
			complete: () => {
				uni.hideLoading()
			},
		})
	})
}
